<?php
/**
 * tpAdmin [a web admin based ThinkPHP5]
 *
 * @author yuan1994 <tianpian0805@gmail.com>
 * @link http://tpadmin.yuan1994.com/
 * @copyright 2016 yuan1994 all rights reserved.
 * @license http://www.apache.org/licenses/LICENSE-2.0
 */

namespace app\common\model;

use think\Model;
use think\Db;
class Groupteam extends Model
{
    /**
     * 获得部门列表
     */
    public function getList($admin_reg){
        $arr=$this->field('id,name,pid,company_id')->where('status=1 and admin_reg= "'.$admin_reg.'" ')->select();
        return $arr;
    }
    /**
     * 通过id获得部门
     */
    public function getListById($id){
        $arr=$this->field('id,name,pid')->where('id='.$id)->select();
        return $arr;
    }
    public function getListByCompanyId($id,$admin_reg){
        $arr=$this->field('id,name,pid')->where('status=1 and admin_reg= "'.$admin_reg.'" and company_id='.$id)->select();
        return $arr;
    }
    /**
     * 通过部门id获取部门下属分组
     * @author sunman
     */
    public function getGroupList($pid){
        $arr=$this->field('id,name,pid,company_id')->where('status=1 and pid="'.$pid.'" and isdelete=0')->select();
        return $arr;   
    }
}